package org.lc.solon.cmd;

import org.lc.solon.cmd.util.BeanUtil;
import org.lc.solon.cmd.util.Lazy;

import java.util.List;

public class ResultManager {
    private static final Lazy<List<ResultHandler>> resultHandlers = new Lazy<>(() -> BeanUtil.sortedBeans(ResultHandler.class));


    public static void handleResult(Object result, String line) {
        for (ResultHandler handler : resultHandlers.get()) {
            if (result == null) {
                break;
            }
            result = handler.handle(result, line);
        }
    }
}
